package edu.yctc.origin.utils;

import org.apache.commons.lang3.StringUtils;

/**
 * 判断是否邮箱工具类
 * 
 * @author 赵宜珺
 *
 */
public class CommonUtils {

    /** 邮箱地址正则 */
    private static final String EMAIL_REGEX =
        "^([a-z0-9A-Z]+[-|\\.]?)+[a-z0-9A-Z]@([a-z0-9A-Z]+(-[a-z0-9A-Z]+)?\\.)+[a-zA-Z]{2,}$";

    /**
     * 判断是否是邮箱地址
     * 
     * @param input
     * @return
     */
    public static boolean isEmailAddress(String input) {
        if (StringUtils.isBlank(input)) {
            return false;
        }
        return input.matches(EMAIL_REGEX);
    }

}
